package com.dabai.iot.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 告警输出分类
 *
 * @author kev1n
 */
@Getter
@AllArgsConstructor
public enum AlarmActionType {
    SMS("1", "短信通知"),
    HTTP_POST("2", "HTTP推送"),
    WECHAT_BOT("3", "企业微信机器人"),
    ;

    private final String value;
    private final String desc;

    /**
     * 根据 value 获取对应的枚举
     */
    public static AlarmActionType fromValue(String value) {
        for (AlarmActionType type : values()) {
            if (Objects.equals(type.value, value)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid type value: " + value);
    }

}
